package thisgame.model;
import java.awt.*;
import java.awt.image.ImageObserver;
import java.io.*;
import java.util.*;
import java.util.List;
import thisgame.*;

public class ThisMap implements Collidable, DrawableProvider {
	public class LineDrawer extends Drawable {
		private Graphics g;
		private int left;
		private int right;
		private Point drawPoint;
		private ImageObserver observer;

		public LineDrawer(Graphics g, int line, int left, int right,
						  Point drawPoint, ImageObserver observer) {
			super(line, 0);
			this.g = g;
			this.left = left;
			this.right = right;
			this.drawPoint = drawPoint;
			this.observer = observer;
		}
		
		public void draw() {
			int x = drawPoint.x, y = drawPoint.y;
			for(int i = left; i <= right; i++) {
				Image tile = tiles[get(i, getTileYCoord())];
				int height = tile.getHeight(observer);
				g.drawImage(tile, x, y-height, observer);
				x += tileSize.width;
			}
		}
	}
	private Image[] tiles;
	private Rect mapArea;
	
	private Dimension tileSize;
	
	static int base[][] = {
			{1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
			{1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,1,1},
			{1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
			{1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
};
	
	public ThisMap() {
		// TODO
		
		// 임시 코드.
		tiles = new Image[]{
				Toolkit.getDefaultToolkit().getImage("tileA.png"),
				Toolkit.getDefaultToolkit().getImage("tileB.png")
		};
		mapArea = new Rect(0, 0, base[0].length, base.length);
		tileSize = new Dimension(32, 32);
	}
	
	public ThisMap(String path) throws IOException {
		loadFromFilePath(path);
	}
	
	public int get(int x, int y) {
		return base[y][x];  // TODO: mock-up code
	}
	
	public int get(Position p) {
		return get(p.getX(), p.getY());
	}
	
	public boolean isCollidedWith(Collection<Position> positions) {
		// TODO Auto-generated method stub
		return false;
	}
	
	public boolean isCollidedWith(Position pos) {
		// 맵 영역 밖으로 나간 것도 충돌로 간주한다.
		return !mapArea.contains(pos) || get(pos) == 1;
	}
	public void loadFromFilePath(String path)
				throws FileNotFoundException {
		Scanner sc = new Scanner(new File(path));
	}
	
	public List<Drawable> provide(Graphics g, Rectangle bound,
								  Position pos, ImageObserver observer) {
		List<Drawable> result = new ArrayList<Drawable>();
		provide(result, g, bound, pos, observer);
		return result;
	}

	public void provide(List<Drawable> result,
						Graphics g, Rectangle bound, Position pos,
						ImageObserver observer) {
		Rect region = new Rect(0, 0,
				bound.width/tileSize.width+1,
				bound.height/tileSize.height+1
				);
		region.setX(pos.getX() - region.getWidth()/2);
		region.setY(pos.getY() - region.getHeight()/2);
		
		// FOR DEBUG
		// System.out.printf("'%d, %d'", region.getLeft(), region.getRight());
		
		int drawPointX = 0, drawPointY = tileSize.height;
		for (int i = region.getTop(); i <= region.getBottom(); i++) {
			result.add(new LineDrawer(g, i, region.getLeft(), region.getRight(),
									  new Point(drawPointX, drawPointY),
									  observer));
			drawPointY += tileSize.height;
		}
	}

	public void set(Position p, int val) {
		base[p.getY()][p.getX()] = val;   // TODO: mock-up code
	}
}
